﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ViMap.Controllers
{
    public class CityController : Controller
    {
        //
        // GET: /City/

        public ActionResult Index()
        {
            return View();
        }

        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult getAll()
        {
            List<BusinessLogic.BizCity> cities = BusinessLogic.BizCity.getAll();
            return Json(cities, JsonRequestBehavior.AllowGet);
        }

        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult getCity(int id)
        {
            BusinessLogic.BizCity city = BusinessLogic.BizCity.getCitybyId(id);
            return Json(city, JsonRequestBehavior.AllowGet);
        }

        [AcceptVerbs(HttpVerbs.Get)]
        public ActionResult getPlaceinCity(int cityId)
        {
            List<BusinessLogic.BizPlace> places = BusinessLogic.BizCity.getPlaceinCity(cityId);
            return Json(places, JsonRequestBehavior.AllowGet);
        }
        
    }
}
